/*
 * Microstate.h
 *
 *  Created on: Jul 11, 2013
 *      Author: x
 */

#ifndef MICROSTATE_H_
#define MICROSTATE_H_

#include <vector>

#include "Conformer.h"
#include "Residue.h"

namespace mcce {


class Microstate {
private:
	std::vector<Conformer*> conformers;
	float eState;
public:
	Microstate();
	explicit Microstate(std::vector<Conformer*> &confs);
	~Microstate();

	// randomly set the initial state of a microstate.
	void setRandomState(std::vector<Residue*> &residues);

	// randomly change to a next microstate.
	Microstate& nextRandomState(std::vector<Residue*> &residues);

	std::vector<Conformer*>& getConformers() {
		return conformers;
	}

	float getEState() const {
		return eState;
	}

	void setEstate(float eState) {
		this->eState = eState;
	}

	/* add a new conformer to the microstate */
	Microstate& addConf(Conformer *conf) {
		conformers.push_back(conf);
		return *this;
	}

	/* return the ith conformer */
	Conformer* confAt(size_t i) {
		return conformers[i];
	}

	/* set the ith conformer in the microstate to conf */
	Microstate& setConfAt(size_t i, Conformer* conf) {
		conformers[i] = conf;
		return *this;
	}

	float calculateEState();

	Microstate& operator=(Microstate &state);
};

} /* namespace mcce */
#endif /* MICROSTATE_H_ */
